Classification with a deep learning neural network


Classification with a deep learning neural network

A deep learning neural network is a combination of supervised learning layers and unsupervised learning layers. However, in this section will use a deep learning network only with supervised learning layers.
Una red neuronal de aprendizaje profundo es una combinación de capas con aprendizaje supervisado y capas con aprendizaje sin supervisión. Sin embargo, en esta sección usted usará una red con aprendizaje profundo con capas de entrenamiento supervisado solamente.

Problem 1
Repeat the problem in Convolutional NN > Classification using a deep learning neural network and SoftMax. Create a new project, select Deep Learning Network, Classification and Genetic Algorithm in the new project dialog. The project name must be Deep1220. After creating the project, copy the following the files from the Conv1220 folder to the Deep1220 folder.
  1. trainSetInput.csv
  2. trainSetTarget.csv
  3. validSetInput.csv

Repita el problema en Convolutional NN > Classification usando una red neuronal de aprendizaje profundo y SoftMax. Cree un nuevo proyecto, seleccione Deep Learning Network, Classification y Genetic Algorithm en el diálogo de nuevo proyecto. El nombre del proyecto debe ser Deep1220. Después de crear el proyecto, copie los siguiente archivos desde la carpeta Conv1220 a la carpeta Deep1220.
  1. trainSetInput.csv
  2. trainSetTarget.csv
  3. validSetInput.csv

Classification

Step A
Edit the Train.lab file, then execute the code. Observe that we will use the logsig function during the training with the Genetic Algorithm, and then, we will use SoftMax (in the output layer) during the training with the Conjugate Gradient method.
Edite el archivo Train.lab, entonces ejecute el código. Observe que usaremos la función logsig durante el entrenamiento con el Algoritmo Genético, y entonces, usaremos SoftMax (en la capa de salida) durante el entrenamiento con el método del Gradiente Conjugado.

Deep1220\Train.lab
//_______________________________________ 1. Network setup
DeepNet net;
net.Create(9, 2);
net.SetLayer(0, 1, 20); // logsig=1, neurons=20
net.SetLayer(1, 5, 3); // SoftMaxReject=5, neurons=3
//_______________________________________ 2. Scaling
int i;
for (i = 0; i < 9; i++)
{
     net.SetInScaler(i, 0.0, 1.0);
}
for (i = 0; i < 3; i++)
{
     net.SetOutScaler(i, 0.0, 1.0);
}
//_______________________________________ 3. Load and set the training set
Matrix trainSetInput;
trainSetInput.Load();
Matrix trainSetTarget;
trainSetTarget.Load();
net.SetTrainSet(trainSetInput, trainSetTarget, false);
//_______________________________________ 4. Train using a genetic algoritm (logsig)
net.TrainGenetic(// ADJUST THE PARAMETERS
);
//_______________________________________ 6. Train using conjugate gradient (SoftMax)
net.TrainConjGrad(2500,1.0e-10);
//_______________________________________ 7. Save the trained network
net.Save();

Step B
Edit the CheckTrain.lab file, then execute the code to check the training.
Edite el archivo CheckTrain.lab, entonces ejecute el código para verificar el entrenamiento.

Deep1220\CheckTrain.lab
//_________________________________________ 1. Load the Training Set
Matrix trainSetInput;
trainSetInput.Load();
Matrix trainSetTarget;
trainSetTarget.Load();
//_________________________________________ 2. Load the network
DeepNet net;
net.Load();
//_________________________________________ 3. Run
Matrix output;
net.Run(trainSetInput, output);
//_________________________________________ 4. Compute the Confusion Matrix
Matrix trainConf = ConfusionMatrix(trainSetTarget, output, 0.5);
trainConf.Save();
//_________________________________________ Compute the Number of Errors
int numErrors = toint(trainConf.GetSum()) - toint(trainConf.GetDiagonalSum());

CheckTrain

Step C
Edit the Validation.lab file, then execute the code to validate the performance of the network.
Edite el archivo Validation.lab, entonces ejecute el código para validar el desempeño de la red neuronal.

Deep1220\Validation.lab
//_________________________________________ 1. Load the validation set
Matrix validSetInput;
validSetInput.Load();
Matrix trainSetTarget;
trainSetTarget.Load();
//_________________________________________ 2. Load the ANN
DeepNet net;
net.Load();
//_________________________________________ 3. Run
Matrix output;
net.Run(validSetInput, output);
//_________________________________________ 4. Compute the confusion matrix
Matrix validConf = ConfusionMatrix(trainSetTarget, output, 0.5);
validConf.Save();
//_________________________________________ 5. Compute the Number of Errors
int numErrors = toint(validConf.GetSum()) - toint(validConf.GetDiagonalSum());

Validation

© Copyright 2000-2021 Wintempla selo. All Rights Reserved. Jul 22 2021. Home